#pragma once

#include <windows.h>
#include <list>

#include "..\Graphics\vector.h"

enum ESystemMessage {
    smEMPTY,
    smMOUSE_MOVED,
    smLEFT_MB_PRESS,
    smLEFT_MB_RELEASE,
    smRIGHT_MB_PRESS,
    smRIGHT_MB_RELEASE,
    smKEY_A_PRESSED,
    smKEY_A_RELEASED,
    smKEY_B_PRESSED,
    smKEY_B_RELEASED,
    smKEY_Q_PRESSED,
    smKEY_Q_RELEASED,
    smTOTAL
};

class SystemMessage
{
public:
    SystemMessage(ESystemMessage messType = smEMPTY, int x = 0, int y = 0) :
        m_Type(messType), m_X(x), m_Y(y)
    {}
    ~SystemMessage() {}

    void Set(ESystemMessage messType, int x, int y) {
        m_Type = messType;
        m_X = x;
        m_Y = y;
    }

    ESystemMessage GetType() { return m_Type; }
    int GetX() { return m_X; }
    int GetY() { return m_Y; }

private:
    ESystemMessage  m_Type;
    int             m_X;
    int             m_Y;
};

typedef std::list<SystemMessage> SystemMessages;


class System
{
public:
	System( int screen_width, int screen_height );
	~System();

	void HandleEvents();
	void UpdateScreen();
	bool IsQuit();

    HWND GetWindowHandle();
    SystemMessages& GetMessages();
	int GetWidth();
	int GetHeight();

	vector2i* GetMousePosition() { return &m_CurrentMousePosition; }

private:
	void init( int screen_width, int screen_height );
	void destroy();

private:
    SystemMessages m_Messages;
    vector2i m_CurrentMousePosition;

	bool m_Quit;

	int m_Width;
	int m_Height;
};

